//
//  CACornerMask+Ext.swift
//  TTCOM
//
//  Created by Toj on 7/18/23.
//

import QuartzCore

/**
 layerMinXMinYCorner // 左上 layerMaxXMinYCorner // 右上
 layerMinXMaxYCorner // 左下 layerMaxXMaxYCorner // 右下
 */
public extension CACornerMask {
    
    // MARK: 单一方向 1个角
    /// 顶部: 左上角
    static var ca_layerTopLeftCorner: CACornerMask {
        return .layerMinXMinYCorner
    }
    
    /// 顶部: 右上角
    static var ca_layerTopRightCorner: CACornerMask {
        return .layerMaxXMinYCorner
    }
    
    /// 底部: 左下角
    static var ca_layerBottomLeftCorner: CACornerMask {
        return .layerMinXMaxYCorner
    }
    
    /// 底部: 右下角
    static var ca_layerBottomRightCorner: CACornerMask {
        return .layerMaxXMaxYCorner
    }
    
    // MARK: 单一方向 2个角
    static var ca_layerTopCorner: CACornerMask {
        return [
            .layerMinXMinYCorner,
            .layerMaxXMinYCorner
        ]
    }
    
    /// 左侧: 2个角
    static var ca_layerLeftCorner: CACornerMask {
        return [
            .layerMinXMinYCorner,
            .layerMinXMaxYCorner
        ]
    }
    
    /// 底部: 2个角
    static var ca_layerBottomCorner: CACornerMask {
        return [
            .layerMinXMaxYCorner,
            .layerMaxXMaxYCorner
        ]
    }
    
    /// 右侧: 2个角
    static var ca_layerRightCorner: CACornerMask {
        return [
            .layerMaxXMinYCorner,
            .layerMaxXMaxYCorner
        ]
    }
    
    // MARK: 对角
    
    /// 左上角 + 右下角
    static var ca_layerBackSlantCorner: CACornerMask {
        return [
            .layerMinXMinYCorner,
            .layerMaxXMaxYCorner
        ]
    }
    
    /// 右上角 + 左下角
    static var ca_layerSlashCorner: CACornerMask {
        return [
            .layerMaxXMinYCorner,
            .layerMinXMaxYCorner
        ]
    }
    
    // MARK: 多方向
    
    /// 除了左上角
    static var ca_layerAllButLeftTop: CACornerMask {
        return [
            .layerMaxXMinYCorner,
            .layerMinXMaxYCorner,
            .layerMaxXMaxYCorner
        ]
    }
    
    /// 除了左下角
    static var ca_layerAllButLeftBottom: CACornerMask {
        return [
            .layerMinXMinYCorner,
            .layerMaxXMinYCorner,
            .layerMaxXMaxYCorner
        ]
    }
    
    /// 除了右上角
    static var ca_layerAllButRightTop: CACornerMask {
        return [
            .layerMinXMinYCorner,
            .layerMinXMaxYCorner,
            .layerMaxXMaxYCorner
        ]
    }
    
    /// 除了右下角
    static var ca_layerAllButRightBottom: CACornerMask {
        return [
            .layerMinXMinYCorner,
            .layerMaxXMinYCorner,
            .layerMinXMaxYCorner
        ]
    }
    
    // MARK: 全部方向
    static var ca_layerAllCorner: CACornerMask {
        return [
            .layerMinXMinYCorner,
            .layerMaxXMinYCorner,
            .layerMinXMaxYCorner,
            .layerMaxXMaxYCorner
        ]
    }
}
